HashMap = function(){  
    this.map = new Array();
};  
HashMap.prototype = {  
    put : function(key, value){  
        this.map[key] = value;
    },  
    get : function(key){  
        return this.map[key];
    },  
    getAll : function(){  
        return this.map;
    },  
    clear : function(){  
        this.map = new Array();
    },  
    getKeys : function(){  
        var keys = new Array();  
        for(i in this.map){  
            keys.push(i);
        }  
        return keys;
    }
};
// 다른 js 파일에서 사용 하려면 전역 변수로 지정 해야됨.
var dataStore = new HashMap();;

// Layout (화면 UI) 
var main_layout;
var top_layout;
var left_layout;
var right_layout;
var right_layout_4U;
var right_layout_4U_bottom;
var right_layout_4U_bottom_2E;

var tabbar;
var tab_device;

var right_info_layout;
var right_location_layout;
var right_requestLog_layout;
var right_chart_layout;
var right_table_layout;

window.onload = function() {
	
	dhtmlx.image_path = contextPath + '/resources/common/js/dhtmlx_std_full/imgs/';
	
	main_layout = new dhtmlXLayoutObject(document.body, '3T', 'dhx_web');
	main_layout.setOffsets({
	    top: 5,
	    right: 5,
	    bottom: 5,
	    left: 10
	});
	top_layout = main_layout.cells('a');
	top_layout.hideHeader();
	top_layout.setHeight('50');
//	top_layout.attachHTMLString('<canvas id='smoothie' width='400' height='80'></canvas>');
	
	left_layout = main_layout.cells('b');

	tabbar = left_layout.attachTabbar();
	tabbar.addTab('tab_device', 'DEVICE', '90');
	tabbar.tabs('tab_device').setActive();	
	tab_device = tabbar.cells('tab_device');

	right_layout = main_layout.cells('c');
	right_layout.setWidth('1000');
	right_layout.setHeight('650');

	right_layout_4U = right_layout.attachLayout('4U');

	right_info_layout = right_layout_4U.cells('a');
	right_info_layout.setText('INFO');
	right_info_layout.setHeight('200');

	right_location_layout = right_layout_4U.cells('b');
	right_location_layout.setText('LOCATION');

	right_requestLog_layout = right_layout_4U.cells('c');
	right_requestLog_layout.setText('REQUEST LOG');

	right_layout_4U_bottom = right_layout_4U.cells('d');

	right_layout_4U_bottom_2E = right_layout_4U_bottom.attachLayout('2E');
	right_layout_4U_bottom_2E.attachEvent('onDblClick', channelChartSearch);
	
	right_chart_layout = right_layout_4U_bottom_2E.cells('a');
	right_chart_layout.setText('CHART');
	
	right_table_layout = right_layout_4U_bottom_2E.cells('b');
	right_table_layout.setText('TABLE');
	
	// 각 컴포넌트 초기화.
	initMainBar();
	initTree();
	initDeviceInfo();
	initMap();
	initRequestLog();
	initChannelTable();
	initChannelChart();
	
	
	
//	var smoothie = new SmoothieChart({
//		  grid: { 	strokeStyle :'rgb(100, 100, 100)', 
//			  		fillStyle :'rgb(0, 0, 0)',
//			  		lineWidth : 1, 
//			  		millisPerLine : 400, 
//			  		verticalSections : 5 },
//			  		labels : { fillStyle:'rgb(255, 255, 255)' ,
//			  				  fontSize:12},
//			  		maxValue:100,
//			  		minValue:0,
//		});
//		smoothie.streamTo(document.getElementById('smoothie'), 1000);//delay
//
//		var line1 = new TimeSeries();
//
//		// Add a random value to each line every second
//		setInterval(function() {
//		  line1.append(new Date().getTime(), (Math.random()*100) + 1);
//		}, 1000);
//
//		// Add to SmoothieChart
//		smoothie.addTimeSeries(line1);
//		smoothie.addTimeSeries(line2);
};
